import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ytbusiness/utils/helper.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';


//订单信息
class OrderInfo extends StatefulWidget {
  @override
  _OrderInfoState createState() => _OrderInfoState();
}

class _OrderInfoState extends State<OrderInfo> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: setWidth(1)),
      padding: EdgeInsets.only(left: setWidth(15),right: setWidth(15),bottom: setWidth(22)),
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _item("订单编号","183819993923"),
          _item("订单时间","2020-11-23 15:00"),
          _item("订单编号","183819993923"),
          _item("VIN","LVHQO6652G6043020"),
          _item("车辆型号","本田 DJFH 2012"),
          Container(
            margin: EdgeInsets.only(top: setWidth(20)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  child: Text("订单状态:",style: TextStyle(color: Color(0xff999999),fontSize: setSp(15)),),
                ),
                SizedBox(
                  width: setWidth(10),
                ),
                Expanded(
                  child: Container(
                    child: Text("待报价",style: TextStyle(color: Color(0xffFF4D4D),fontSize: setSp(15),),),
                  ),
                ),
              ],
            ),
          ),
          _item("采购方","本田 DJFH 2012"),
          Container(
            margin: EdgeInsets.only(top: setWidth(20)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  child: Text("收货信息:",style: TextStyle(color: Color(0xff999999),fontSize: setSp(15)),),
                ),
                SizedBox(
                  width: setWidth(10),
                ),
                Expanded(
                  child:RichText(text: TextSpan(
                      children: [

                        TextSpan(text:"某某某 12545689756 安徽省合肥市庐阳区万科中心2154",
                            style: TextStyle(color: Color(0xff333333),
                              fontSize: setSp(15),)),
                        WidgetSpan(child: SizedBox(width: setWidth(10),)),
                        WidgetSpan(child: GestureDetector(
                          onTap: (){
                            copy("某某某 12545689756 安徽省合肥市庐阳区万科中心2154");
                          },
                          child: Text("复制",style: TextStyle(color: Color(0xff4D8ADD),fontSize: setSp(15),)),
                        )),
                      ]
                  )),
                ),
              ],
            ),
          ),
        ],
      ),

    );
  }

 Widget _item(String title,String content){
    return  Container(
      margin: EdgeInsets.only(top: setWidth(20)),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            child: Text("$title:",style: TextStyle(color: Color(0xff999999),fontSize: setSp(15)),),
          ),
          SizedBox(
            width: setWidth(10),
          ),
          Expanded(
            child: Container(
              child: Text(content,style: TextStyle(color: Color(0xff333333),fontSize: setSp(15),),),
            ),
          ),
        ],
      ),
    );

  }
}
